#pragma once


namespace mystl
{
    template<class T>
    struct Node
    {
        T data = 0;
        Node<T>* _prev = nullptr;
        Node<T>* _next = nullptr;
    };
    template<class T>
    class list
    {
    public:
        list()
        {
            _head = new Node;
            _head->_prev = _head;
            _head->_next = _head;
        }

        void push_back(const T& val)
        {
            Node<T>* newNode = new Node;
            newNode->data = val;
            newNode->_prev = _head->_prev;
            newNode->_next = _head;
            _head->_prev->_next = newNode;
            _head->_next = newNode;
            _head->_prev = newNode;
        }
        void pop_back()
        {
            assert(_head->_next != _head);
            Node<T>* backNode = _head->_prev;
            Node<T>* node = backNode->_prev;
            //TODO
        }
    private:
        Node<T>* _head = nullptr;   //哨兵
    };
}